package com.usian.article.controller;


import com.usian.apis.admin.ApArticleControllerApi;
import com.usian.article.service.ApArticleService;
import com.usian.article.service.ApCollectionService;
import com.usian.model.article.ApArticle;
import com.usian.model.article.CollectionBehaviorDto;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/article")
public class ApArticleController implements ApArticleControllerApi {

    @Autowired
    private ApArticleService articleService;
    @Autowired
    private ApCollectionService apCollectionService;

    @PostMapping("save")
    @Override
    public ApArticle saveArticle(@RequestBody ApArticle apArticle) {
        articleService.save(apArticle);
        return apArticle;
    }
    /**
     * 袁浩 2022-6-29
     * 文章收藏
     */
     @PostMapping("/article_sc")
    public ResponseResult collectionBehavior(@RequestBody CollectionBehaviorDto dto){
        return apCollectionService.sc(dto);
    }
}
